def itemgetter(obj: dict, attr: str):
    """
    不能处理内嵌数组类型的值
    """
    for name in attr.split("."):
        obj = obj.get(name)
        if not isinstance(obj, dict):
            break
    return obj


def itemsetter(obj: dict, field: str, value):
    """
    不能处理内嵌数组的值
    """
    if value is None:
        return
    names = field.split('.')
    depth = len(names)
    if depth == 1:
        obj[field] = value
        return
    for i in range(0, depth-1):
        name = names[i]
        v = obj.get(name)
        if v is None:
            v = dict()
            obj[name] = v
        obj = v
    obj[names[-1]] = value
